<%@LANGUAGE="VBSCRIPT"%>
 
<!--#include file="functions.asp" -->

<%
' AND (STATUS = 'COMPLETED' OR STATUS='INVOICED' OR STATUS='OPEN' )
set CompCode = Server.CreateObject("ADODB.Recordset")
CompCode.ActiveConnection = cn
CompCode.Source = "SELECT *  FROM dbo.COMPCODE"
'CompCode.CursorType = 0
'CompCode.CursorLocation = 2
'CompCode.LockType = 3
CompCode.Open()
CompCode_numRows = 0
%>
<%
Dim EXIREG__tmpNum
EXIREG__tmpNum = "''"
if (Request.QueryString("LVONum")  <> "") then EXIREG__tmpNum = Request.QueryString("LVONum") 
%>
<%
set EXIREG = Server.CreateObject("ADODB.Recordset")
EXIREG.ActiveConnection = cn
if (Request.QueryString("LVONum")  <> "") then
EXIREG.Source = "SELECT LVONUM, SEQNUM, REGNUM, INVNUM, CREATEDBY, REQUESTEDBY, UCCODE,STATUS, VENDORID, INVDATE, (DATEADD(DAY,3,INVDATE)) AS INVDUEDATE,ORDERDATE,DUEDATE, INVRECBY,DEPT, MP2CURRENCY, SYMBOL, COMPCODE, VATNUM, WHTNAME, VATRATE, SUBTOTAL,WHTRATE, WHTAMOUNT, VATPAIDTOVENDOR,  "_
&"(SELECT TOP 1 VENDOR.NAME  FROM VENDOR  WHERE VENDOR.VENDORID=EXILVOHEADER.VENDORID) AS VENDORNAME, "_
&"(SELECT LOCNAME=CASE WHEN LASTNAME IS NOT NULL THEN EMP.FIRSTNAME + ' '  + EMP.LASTNAME WHEN LASTNAME IS NULL THEN EMP.FIRSTNAME END FROM dbo.EMP WHERE EMP.EMPCODE=EXILVOHEADER.ROUTEUSER) AS LOCNAME,  "_
&"(SELECT EMPNAME=CASE WHEN LASTNAME IS NOT NULL THEN EMP.FIRSTNAME + ' '  + EMP.LASTNAME WHEN LASTNAME IS NULL THEN EMP.FIRSTNAME END FROM dbo.EMP WHERE EMP.EMPCODE=EXILVOHEADER.INVRECBY) AS EMPNAME, INVVER, "_
&"(SELECT VERNAME=CASE WHEN LASTNAME IS NOT NULL THEN EMP.FIRSTNAME + ' '  + EMP.LASTNAME WHEN LASTNAME IS NULL THEN EMP.FIRSTNAME END FROM dbo.EMP WHERE EMP.EMPCODE=EXILVOHEADER.INVVER) AS VERNAME,INVAPPR,"_
&"(SELECT APPRNAME=CASE WHEN LASTNAME IS NOT NULL THEN EMP.FIRSTNAME + ' '  + EMP.LASTNAME WHEN LASTNAME IS NULL THEN EMP.FIRSTNAME END FROM dbo.EMP WHERE EMP.EMPCODE=EXILVOHEADER.INVAPPR) AS APPRNAME,INVVERDATE, INVAPPRDATE, ROUTEUSER,REFERENCEDOC, COMMENTS  FROM dbo.EXILVOHEADER  WHERE LVONUM='" + Replace(EXIREG__tmpNum, "'", "''") + "'"
else
EXIREG.Source = "SELECT LVONUM, SEQNUM, REGNUM, INVNUM, CREATEDBY, REQUESTEDBY, UCCODE,STATUS, VENDORID, INVDATE, (DATEADD(DAY,3,INVDATE)) AS INVDUEDATE,ORDERDATE,DUEDATE, INVRECBY,DEPT, MP2CURRENCY, SYMBOL, COMPCODE, VATNUM, WHTNAME, VATRATE, SUBTOTAL,WHTRATE, WHTAMOUNT, VATPAIDTOVENDOR,  "_
&"(SELECT TOP 1 VENDOR.NAME  FROM VENDOR  WHERE VENDOR.VENDORID=EXILVOHEADER.VENDORID) AS VENDORNAME, "_
&"(SELECT LOCNAME=CASE WHEN LASTNAME IS NOT NULL THEN EMP.FIRSTNAME + ' '  + EMP.LASTNAME WHEN LASTNAME IS NULL THEN EMP.FIRSTNAME END FROM dbo.EMP WHERE EMP.EMPCODE=EXILVOHEADER.ROUTEUSER) AS LOCNAME,  "_
&"(SELECT EMPNAME=CASE WHEN LASTNAME IS NOT NULL THEN EMP.FIRSTNAME + ' '  + EMP.LASTNAME WHEN LASTNAME IS NULL THEN EMP.FIRSTNAME END FROM dbo.EMP WHERE EMP.EMPCODE=EXILVOHEADER.INVRECBY) AS EMPNAME, INVVER, "_
&"(SELECT VERNAME=CASE WHEN LASTNAME IS NOT NULL THEN EMP.FIRSTNAME + ' '  + EMP.LASTNAME WHEN LASTNAME IS NULL THEN EMP.FIRSTNAME END FROM dbo.EMP WHERE EMP.EMPCODE=EXILVOHEADER.INVVER) AS VERNAME,INVAPPR,"_
&"(SELECT APPRNAME=CASE WHEN LASTNAME IS NOT NULL THEN EMP.FIRSTNAME + ' '  + EMP.LASTNAME WHEN LASTNAME IS NULL THEN EMP.FIRSTNAME END FROM dbo.EMP WHERE EMP.EMPCODE=EXILVOHEADER.INVAPPR) AS APPRNAME,INVVERDATE, INVAPPRDATE, ROUTEUSER,REFERENCEDOC, COMMENTS  FROM dbo.EXILVOHEADER  WHERE  STATUS = 'COMPLETED' OR STATUS='INVOICED' OR STATUS='OPEN' OR STATUS='ROUTED'"
end if
'EXIREG.CursorType = 0
'EXIREG.CursorLocation = 2
'EXIREG.LockType = 3
EXIREG.Open()
EXIREG_numRows = 0
%>

<%
Dim LVODET__tmpNum
LVODET__tmpNum = "''"
if (Request.QueryString("LVONum") <> "") then LVODET__tmpNum = Request.QueryString("LVONum")
%>
<%
set LVODET = Server.CreateObject("ADODB.Recordset")
LVODET.ActiveConnection = cn
LVODET.Source = "SELECT SEQNUM,DESCRIPTION, QTYREQUESTED, UOP, UNITCOST, TOTAL, LINENUMBER, COSTCENTER, ACCTCODE, ACTCODE, TAXCODE, DEPTEMPCODE  FROM dbo.EXILVOREQ  WHERE LVONUM='" + Replace(LVODET__tmpNum, "'", "''") + "'  ORDER BY LINENUMBER"
'LVODET.CursorType = 0
'LVODET.CursorLocation = 2
'LVODET.LockType = 3
LVODET.Open()
LVODET_numRows = 0
%>
<%
Dim Repeat1__numRows
Repeat1__numRows = -1
Dim Repeat1__index
Repeat1__index = 0
LVODET_numRows = LVODET_numRows + Repeat1__numRows
%>
<%
'  *** Recordset Stats, Move To Record, and Go To Record: declare stats variables

' set the record count
EXIREG_total = EXIREG.RecordCount

' set the number of rows displayed on this page
If (EXIREG_numRows < 0) Then
  EXIREG_numRows = EXIREG_total
Elseif (EXIREG_numRows = 0) Then
  EXIREG_numRows = 1
End If

' set the first and last displayed record
EXIREG_first = 1
EXIREG_last  = EXIREG_first + EXIREG_numRows - 1

' if we have the correct record count, check the other stats
If (EXIREG_total <> -1) Then
  If (EXIREG_first > EXIREG_total) Then EXIREG_first = EXIREG_total
  If (EXIREG_last > EXIREG_total) Then EXIREG_last = EXIREG_total
  If (EXIREG_numRows > EXIREG_total) Then EXIREG_numRows = EXIREG_total
End If
%>
<%
' *** Move To Record and Go To Record: declare variables

Set MM_rs    = EXIREG
MM_rsCount   = EXIREG_total
MM_size      = EXIREG_numRows
MM_uniqueCol = ""
MM_paramName = ""
MM_offset = 0
MM_atTotal = false
MM_paramIsDefined = false
If (MM_paramName <> "") Then
  MM_paramIsDefined = (Request.QueryString(MM_paramName) <> "")
End If
%>
<%
' *** Move To Record: handle 'index' or 'offset' parameter

if (Not MM_paramIsDefined And MM_rsCount <> 0) then

  ' use index parameter if defined, otherwise use offset parameter
  r = Request.QueryString("index")
  If r = "" Then r = Request.QueryString("offset")
  If r <> "" Then MM_offset = Int(r)

  ' if we have a record count, check if we are past the end of the recordset
  If (MM_rsCount <> -1) Then
    If (MM_offset >= MM_rsCount Or MM_offset = -1) Then  ' past end or move last
      If ((MM_rsCount Mod MM_size) > 0) Then         ' last page not a full repeat region
        MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
      Else
        MM_offset = MM_rsCount - MM_size
      End If
    End If
  End If

  ' move the cursor to the selected record
  i = 0
  While ((Not MM_rs.EOF) And (i < MM_offset Or MM_offset = -1))
    MM_rs.MoveNext
    i = i + 1
  Wend
  If (MM_rs.EOF) Then MM_offset = i  ' set MM_offset to the last possible record

End If
%>
<%
' *** Move To Record: if we dont know the record count, check the display range

If (MM_rsCount = -1) Then

  ' walk to the end of the display range for this page
  i = MM_offset
  While (Not MM_rs.EOF And (MM_size < 0 Or i < MM_offset + MM_size))
    MM_rs.MoveNext
    i = i + 1
  Wend

  ' if we walked off the end of the recordset, set MM_rsCount and MM_size
  If (MM_rs.EOF) Then
    MM_rsCount = i
    If (MM_size < 0 Or MM_size > MM_rsCount) Then MM_size = MM_rsCount
  End If

  ' if we walked off the end, set the offset based on page size
  If (MM_rs.EOF And Not MM_paramIsDefined) Then
    If (MM_offset > MM_rsCount - MM_size Or MM_offset = -1) Then
      If ((MM_rsCount Mod MM_size) > 0) Then
        MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
      Else
        MM_offset = MM_rsCount - MM_size
      End If
    End If
  End If

  ' reset the cursor to the beginning
  If (MM_rs.CursorType > 0) Then
    MM_rs.MoveFirst
  Else
    MM_rs.Requery
  End If

  ' move the cursor to the selected record
  i = 0
  While (Not MM_rs.EOF And i < MM_offset)
    MM_rs.MoveNext
    i = i + 1
  Wend
End If
%>
<%
' *** Move To Record: update recordset stats

' set the first and last displayed record
EXIREG_first = MM_offset + 1
EXIREG_last  = MM_offset + MM_size
If (MM_rsCount <> -1) Then
  If (EXIREG_first > MM_rsCount) Then EXIREG_first = MM_rsCount
  If (EXIREG_last > MM_rsCount) Then EXIREG_last = MM_rsCount
End If

' set the boolean used by hide region to check if we are on the last record
MM_atTotal = (MM_rsCount <> -1 And MM_offset + MM_size >= MM_rsCount)
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters

' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "") Then MM_removeList = MM_removeList & "&" & MM_paramName & "="
MM_keepURL="":MM_keepForm="":MM_keepBoth="":MM_keepNone=""

' add the URL parameters to the MM_keepURL string
For Each Item In Request.QueryString
  NextItem = "&" & Item & "="
  If (InStr(1,MM_removeList,NextItem,1) = 0) Then
    MM_keepURL = MM_keepURL & NextItem & Server.URLencode(Request.QueryString(Item))
  End If
Next

' add the Form variables to the MM_keepForm string
For Each Item In Request.Form
  NextItem = "&" & Item & "="
  If (InStr(1,MM_removeList,NextItem,1) = 0) Then
    MM_keepForm = MM_keepForm & NextItem & Server.URLencode(Request.Form(Item))
  End If
Next

' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
if (MM_keepBoth <> "") Then MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
if (MM_keepURL <> "")  Then MM_keepURL  = Right(MM_keepURL, Len(MM_keepURL) - 1)
if (MM_keepForm <> "") Then MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)

' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
  If (firstItem <> "") Then
    MM_joinChar = "&"
  Else
    MM_joinChar = ""
  End If
End Function
%>
<%
' *** Move To Record: set the strings for the first, last, next, and previous links

MM_keepMove = MM_keepBoth
MM_moveParam = "index"

' if the page has a repeated region, remove 'offset' from the maintained parameters
If (MM_size > 0) Then
  MM_moveParam = "offset"
  If (MM_keepMove <> "") Then
    params = Split(MM_keepMove, "&")
    MM_keepMove = ""
    For i = 0 To UBound(params)
      nextItem = Left(params(i), InStr(params(i),"=") - 1)
      If (StrComp(nextItem,MM_moveParam,1) <> 0) Then
        MM_keepMove = MM_keepMove & "&" & params(i)
      End If
    Next
    If (MM_keepMove <> "") Then
      MM_keepMove = Right(MM_keepMove, Len(MM_keepMove) - 1)
    End If
  End If
End If

' set the strings for the move to links
If (MM_keepMove <> "") Then MM_keepMove = MM_keepMove & "&"
urlStr = Request.ServerVariables("URL") & "?" & MM_keepMove & MM_moveParam & "="
MM_moveFirst = urlStr & "0"
MM_moveLast  = urlStr & "-1"
MM_moveNext  = urlStr & Cstr(MM_offset + MM_size)
prev = MM_offset - MM_size
If (prev < 0) Then prev = 0
MM_movePrev  = urlStr & Cstr(prev)
%>
<SCRIPT Language="JavaScript">
var InvStatus='<%= request.querystring("InvStatus") %>';
var dsort='<%= request.querystring("dsort") %>';
var dorder='<%= request.querystring("dorder") %>';
var Location='<%= request.querystring("Location") %>';
var UserCoord='<%= request.querystring("UserCoord") %>';
var RefOrder='<%= request.querystring("refOrder") %>';
var VendorID='<%= request.querystring("VendorID") %>';
var CurSymbol='<%= request.querystring("CurSymbol") %>';

function DocLoad(){
document.form1.reqInvoiceNo.focus();
}

function CheckWHT(y)
{ if (y!="") {
window.open("ValWHT.asp?WHTID="+y+"&src=document.form1.WHTName&fld=document.form1.WHTRate","","width=300,height=120,Top=240,Left=240,toolbar=no,location=no,directories=no,status=no,scrollbars=no,menubar=no,resizable=no,")
} 
else document.form1.WHTRate.value="";
}

function CheckEmp(y)
{ if (y!="") {
window.open("ValEmpl.asp?EmpID="+y+"&src=document.form1.reqReceivedBy&fld=document.form1.empName&fld2=document.form1.Dept","","width=300,height=120,Top=240,Left=240,toolbar=no,location=no,directories=no,status=no,scrollbars=no,menubar=no,resizable=no,")
} 
else 
{
document.form1.empName.value="";
}
}

function redirect(){
location='InvList_LVO.asp?InvStatus='+InvStatus+'&dsort='+ dsort+'&dorder='+ dorder+'&Location='+Location+'&UserCoord='+UserCoord+'&VendorID='+VendorID+'&CurSymbol='+CurSymbol;
return false
}

function reroute(a,b){
location='Inv_Routing_LVO.asp?route='+a+ '&seqnum='+b+'&InvStatus='+InvStatus+'&dsort='+ dsort+'&dorder='+ dorder+'&Location='+Location+'&UserCoord='+UserCoord+'&VendorID='+VendorID+'&CurSymbol='+CurSymbol;
return false
}

function redirect2(which){
location='Inv_DetailLVO.asp?LVONum='+ which +'&InvStatus='+InvStatus+'&dsort='+ dsort+'&dorder='+ dorder+'&Location='+Location+'&UserCoord='+UserCoord+'&VendorID='+VendorID+'&CurSymbol='+CurSymbol;
return false
}
</SCRIPT>
<!-- #include file="pagetop.asp" -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr> 
    <td nowrap height="21" bgcolor="#FFFFFF" width="3%" background="images/menu_end.gif">&nbsp;</td>
    <td nowrap height="21" bgcolor="#FFFFFF" width="28"> 
      <div align="center"><img src="images/menu_awal_off.gif" width="28" height="33"></div>
    </td>
    <td width="10%" background="images/menuoff.gif" height="21" nowrap> 
      <div align="center"><b><a href="InvList_LVO.asp?CurSymbol=N&invStatus=0" class="menu">LVO List</a></b></div>
    </td>
    <td nowrap height="21" width="28"><img src="images/menu_off_on_separator.gif" width="28" height="33"></td>
    <td width="10%" background="images/menuon.gif" height="21" nowrap> 
      <div align="center"><b class="menu">Record View</b></div>
    </td>
    <td height="21" bgcolor="#FFFFFF" width="11"><img src="images/Menu_onend.gif" width="13" height="33"></td>
    <td height="21" bgcolor="#FFFFFF" background="images/menu_end.gif"> 
      <div align="right"><b><font color="#003399">Invoice From LVO</font></b> 
      </div>
    </td>
  </tr>
  <tr bgcolor="#93bee2"> 
    <td height="21" width="3%" bgcolor="#93bee2">&nbsp;</td>
    <td height="21" width="28" bgcolor="#93bee2">&nbsp;</td>
    <td width="10%" height="21" bgcolor="#93bee2">&nbsp;</td>
    <td height="21" width="28">&nbsp;</td>
    <td width="10%" height="21">&nbsp;</td>
    <td height="21">&nbsp;</td>
    <td height="21">&nbsp;</td>
  </tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#93bee2">
  <tr> 
    <td width="4%">&nbsp;</td>
    <td width="2%">&nbsp;</td>
    <td width="94%"> 
      <table border="0" width="50%" align="left">
        <tr> 
          <td width="23%" align="center" height="25"> <b> 
            <% If MM_offset <> 0 Then %>
            <a href="<%=MM_moveFirst%>">&lt;&lt; 
            First</a> 
            <% End If ' end MM_offset <> 0 %>
            </b></td>
          <td width="31%" align="center" height="25"> <b> 
            <% If MM_offset <> 0 Then %>
            <a href="<%=MM_movePrev%>">&lt; 
            Previous</a> 
            <% End If ' end MM_offset <> 0 %>
            </b></td>
          <td width="23%" align="center" height="25"> <b> 
            <% If Not MM_atTotal Then %>
            <a href="<%=MM_moveNext%>">Next 
            &gt; </a> 
            <% End If ' end Not MM_atTotal %>
            </b></td>
          <td width="23%" align="center" height="25"> <b> 
            <% If Not MM_atTotal Then %>
            <a href="<%=MM_moveLast%>">Last 
            &gt;&gt; </a> 
            <% End If ' end Not MM_atTotal %>
            </b></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr> 
    <td width="4%">&nbsp;</td>
    <td width="2%">&nbsp;</td>
    <td width="94%">&nbsp;</td>
  </tr>
  <tr> 
    <td width="4%">&nbsp;</td>
    <td width="2%" bgcolor="#FFFFFF"><img src="images/curv_data.gif" width="21" height="21"></td>
    <td bgcolor="#FFFFFF" width="94%">&nbsp;</td>
  </tr>
  <tr> 
    <td width="4%">&nbsp;</td>
    <td width="2%" bgcolor="#FFFFFF">&nbsp;</td>
    <td bgcolor="#FFFFFF" width="94%"> 
      <form name="form1" method="post" action="LVO_Process.asp" onSubmit="return checkrequired(this)">
        <table width="100%" border="0" cellspacing="2" cellpadding="3">
          <tr> 
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>LVO No.:&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td width="30%" valign="middle"> 
              <input type="text" name="LVONum" class="InputBox" size="15" maxlength="15" value="<%= request.querystring("LVONum") %>">
              <input type="button" name="Submit6" value=" Search... " class="sbttn" onClick="return redirect2(document.form1.LVONum.value)">
            </td>
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>Status:&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td><b><font color="#880000"><%=(EXIREG.Fields.Item("STATUS").Value)%></font></b></td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>Register No.:&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td width="30%"> 
              <input type="text" name="RegNo" size="15" maxlength="15" class="InputBox" value="<%=(EXIREG.Fields.Item("REGNUM").Value)%>" readOnly=true>
              <input type="hidden" name="seqnum2" value="<%=(EXIREG.Fields.Item("LVONUM").Value)%>">
              <input type="hidden" name="seqnum3" value="<%=(EXIREG.Fields.Item("SEQNUM").Value)%>">
            </td>
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>Invoice No.:&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td> 
              <input type="text" name="reqInvoiceNo" size="25" maxlength="25" class="InputBox" value="<%=(EXIREG.Fields.Item("INVNUM").Value)%>">
              <input type="button" name="Submit53" value="View Invoice" class="sbttn" onClick="opennew('<%=(EXIREG("REFERENCEDOC"))%>')">
            </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>Received Date:&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td width="30%"> 
              <input type="text" name="ReceivedDate" size="12" maxlength="12" class="InputBox" value="<%=(EXIREG.Fields.Item("INVDATE").Value)%>" >
              <input type="button" name="Submit5" value=" ... " class="sbttn" onClick="javascript:show_calendar('form1.ReceivedDate');" >
              <script language="JavaScript">
function AddDate(x)
{
var CurDate=new Date(x);
var ms=CurDate.getTime()+30*86400000;
var newDate=new Date(ms) ;
document.form1.DueDate.value = new String((newDate.getMonth()+1)+'/'+newDate.getDate()+'/'+newDate.getYear());
//document.form1.DueDate.value = String(CurDate);
}
</script>
            </td>
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>Received By:&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td> 
              <input type="text" name="reqReceivedBy" size="12" maxlength="10" class="InputBox" value="<%=(EXIREG.Fields.Item("INVRECBY").Value)%>" onBlur="CheckEmp(this.value);">
              <input type="button" name="Button223" value=" ... " class="sbttn" onClick="openpopup('EmpList.asp?fName=form1.reqReceivedBy&fName2=form1.empName&fName3=form1.Dept')" >
              <input type="hidden" name="Dept">
            </td>
          </tr>
          <tr> 
            <td width="15%"> 
              <div align="right"></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td width="30%">&nbsp; </td>
            <td width="15%"> 
              <div align="right"></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td> 
              <input type="text" name="empName" size="35" class="InputBox" value="<%=(EXIREG.Fields.Item("EMPNAME").Value)%>">
            </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede" height="22"> 
              <div align="right"><b>Order Date:&nbsp;</b></div>
            </td>
            <td width="2%" height="22">&nbsp;</td>
            <td width="30%" height="22"> <%= DoDateTime((EXIREG.Fields.Item("ORDERDATE").Value), 1, 2057) %> 
            </td>
            <td width="15%" bgcolor="#dedede" height="22"> 
              <div align="right"><b>Due Date:&nbsp;</b></div>
            </td>
            <td width="2%" height="22">&nbsp;</td>
            <td bgcolor="#FFFFFF" height="22"> <%= DoDateTime((EXIREG.Fields.Item("DUEDATE").Value), 1, 2057) %> 
            </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede" height="21"> 
              <div align="right"><b>Vendor ID:&nbsp;</b></div>
            </td>
            <td width="2%" height="21">&nbsp;</td>
            <td width="30%" height="21"> <%=(EXIREG.Fields.Item("VENDORID").Value)%> 
            </td>
            <td width="15%" height="21" bgcolor="#dedede"> 
              <div align="right"><b>Current Location:</b> </div>
            </td>
            <td width="2%" height="21">&nbsp;</td>
            <td bgcolor="#FFFFFF" height="21"><b><font color="#CC3300"><%=(EXIREG.Fields.Item("LOCNAME").Value)%></font></b> 
            </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede" height="21"> 
              <div align="right"><b>Vendor Name:&nbsp;</b></div>
            </td>
            <td width="2%" height="21">&nbsp;</td>
            <td height="21"> <%=(EXIREG.Fields.Item("VENDORNAME").Value)%> </td>
            <td bgcolor="#dedede" height="21"> 
              <div align="right"><b>Created By:&nbsp;</b></div>
            </td>
            <td height="21">&nbsp;</td>
            <td height="21"><%=(EXIREG.Fields.Item("CREATEDBY").Value)%> </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede" height="21"> 
              <div align="right"><b>Currency:&nbsp;</b></div>
            </td>
            <td width="2%" height="21">&nbsp;</td>
            <td width="30%" height="21"> <%=(EXIREG.Fields.Item("MP2CURRENCY").Value)%> 
            </td>
            <td width="15%" bgcolor="#dedede" height="21"> 
              <div align="right"><b>Requested By:&nbsp;</b></div>
            </td>
            <td width="2%" height="21">&nbsp;</td>
            <td height="21"><%=(EXIREG.Fields.Item("REQUESTEDBY").Value)%> </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede" height="21"> 
              <div align="right"><b>Sub Total:&nbsp;</b></div>
            </td>
            <td width="2%" height="21">&nbsp;</td>
            <td width="30%" height="21"> <b><%=(EXIREG.Fields.Item("SYMBOL").Value)%>&nbsp;&nbsp; 
              <%=(FormatNumber((EXIREG.Fields.Item("SUBTOTAL").Value), -1, -2, -2, -1))%> 
              </b> </td>
            <td width="15%" bgcolor="#dedede" height="21"> 
              <div align="right"><b>Department:&nbsp;</b></div>
            </td>
            <td width="2%" height="21">&nbsp;</td>
            <td height="21"> <%=(EXIREG.Fields.Item("DEPT").Value)%> </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>T0 Code:&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td width="30%"> 
              <select name="CompCode" class="drpdwn">
                <%
While (NOT CompCode.EOF)
%>
                <option value="<%=(CompCode.Fields.Item("COMPCODE").Value)%>" <% if (CompCode.Fields.Item("COMPCODE").Value =EXIREG.Fields.Item("COMPCODE").Value) then response.write "selected" %>><%=(CompCode.Fields.Item("COMPCODE").Value)%> 
                - <%=(CompCode.Fields.Item("COMPCODEDESC").Value)%></option>
                <%
  CompCode.MoveNext()
Wend
If (CompCode.CursorType > 0) Then
  CompCode.MoveFirst
Else
  CompCode.Requery
End If
%>
              </select>
            </td>
            <td width="15%"> 
              <div align="right"></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td> 
              <input type="checkbox" name="cbVAT" value="Y" <% if (EXIREG.Fields.Item("VATPAIDTOVENDOR").Value="Y") then response.write "checked" %>>
              VAT Paid To Vendor </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#FFFFFF"> 
              <div align="right"><b></b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td width="30%">&nbsp;</td>
            <td width="15%" bgcolor="#FFFFFF">&nbsp;</td>
            <td width="2%">&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>WHT Name:&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td width="30%"> 
              <input type="text" name="WHTName" size="15" maxlength="15" class="InputBox" value="<%=(EXIREG.Fields.Item("WHTNAME").Value)%>" onBlur="CheckWHT(this.value);calcWHT(document.form1.WHTRate.value,<%= EXIREG.Fields.Item("SUBTOTAL").Value %>)">
              <input type="button" name="Button2232" value=" ... " class="sbttn" onClick="openpopup('WHTList.asp?fName=form1.WHTName&fName2=form1.WHTRate')" onBlur="calcWHT(document.form1.WHTRate.value,<%= EXIREG.Fields.Item("SUBTOTAL").Value %>)">
            </td>
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>WHT Rate:&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td> 
              <input type="text" name="WHTRate" size="6" maxlength="6" class="NumBox" onBlur="calcWHT(this.value,<%= EXIREG.Fields.Item("SUBTOTAL").Value %>)" value="<%=(EXIREG.Fields.Item("WHTRATE").Value)%>">
              <script language="JavaScript">
function calcWHT(x,y){
  var WHTRate = Number(x);
  var InvAmt = Number(y);
  var WHTAmt = 0;
  WHTAmt = InvAmt * WHTRate/100;
  document.form1.WHTAmt.value=String(WHTAmt);
}
</script>
            </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>VAT Rate:&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td width="30%"> 
              <input type="text" name="VATRate" class="NumBox" size="6" maxlength="6" value="<%=(EXIREG.Fields.Item("VATRATE").Value)%>">
            </td>
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>WHT Amount:&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td> 
              <input type="text" name="WHTAmt" size="15" maxlength="15" class="NumBox" value="<%=(EXIREG.Fields.Item("WHTAMOUNT").Value)%>">
            </td>
          </tr>
          <tr>
            <td width="15%" bgcolor="#FFFFFF">&nbsp;</td>
            <td width="2%">&nbsp;</td>
            <td colspan="4">&nbsp;</td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede" align="right"><b>Verified By:&nbsp;</b></td>
            <td width="2%">&nbsp;</td>
            <td colspan="4"> 
              <input type="text" name="reqEndUser" size="10" class="GridBox" value="<%=(EXIREG.Fields.Item("INVVER").Value)%>" readonly=true>
              &nbsp; 
              <input type="text" name="empName2" size="30" class="GridBox" value="<%=(EXIREG.Fields.Item("VERNAME").Value)%>">
              &nbsp; 
              <% if (EXIREG.Fields.Item("INVVERDATE").Value<>"") then %>
              <img src="images/check.jpg" width="18" height="17">&nbsp;Verified &nbsp;
              <%= EXIREG.Fields.Item("INVVERDATE").Value %>
			  <% end if %>
              <input type="hidden" name="Dept2" size="15" class="InputBox" value="<%=(EXIREG.Fields.Item("DEPT").Value)%>">
            </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede" align="right"><b>Approved By:&nbsp;</b></td>
            <td width="2%">&nbsp;</td>
            <td colspan="4"> 
              <input type="text" name="reqAuthorised" size="10" class="GridBox" value="<%=(EXIREG.Fields.Item("INVAPPR").Value)%>" readonly=true>
              &nbsp;
              <input type="text" name="AuthoName" size="30" class="GridBox" value="<%=(EXIREG.Fields.Item("APPRNAME").Value)%>">
              &nbsp; 
              <% if (EXIREG.Fields.Item("INVAPPRDATE").Value<>"") then %>
              <img src="images/check.jpg" width="18" height="17">&nbsp;Approved &nbsp;
              <%= EXIREG.Fields.Item("INVAPPRDATE").Value %><% end if %>
            </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#FFFFFF">&nbsp;</td>
            <td width="2%">&nbsp;</td>
            <td colspan="4">&nbsp;</td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>Comments:&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td colspan="4"> 
              <textarea name="Notes" cols="60" rows="5" class="InputBox"><%=(EXIREG.Fields.Item("COMMENTS").Value)%></textarea>
            </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#FFFFFF" height="20">&nbsp;</td>
            <td width="2%" height="20">&nbsp;</td>
            <td width="30%" height="20">&nbsp;</td>
            <td width="15%" bgcolor="#FFFFFF" height="20">&nbsp;</td>
            <td width="2%" height="20">&nbsp;</td>
            <td height="20">&nbsp;</td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>Action:&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td colspan="4"> 
              <% if(EXIREG.Fields.Item("STATUS").Value="OPEN")or (EXIREG.Fields.Item("STATUS").Value="RECEIVING")or (EXIREG.Fields.Item("STATUS").Value="COMPLETED")then %>
              <input type="submit" name="Submit" value=" Invoiced  " class="sbttn" onClick="document.form1.reqEndUser.value=' ';document.form1.reqAuthorised.value=' ';">
              <% end if %>
              <% if(EXIREG.Fields.Item("STATUS").Value="INVOICED") then %>
              <input type="submit" name="Submit2" value="Uninvoiced" class="sbttn">
              <% end if %>
              <input type="button" name="Submit3" value="Print Receipt" class="sbttn" onClick="window.location='inv_Print_LVO.asp?refOrder=Y&seqnum=<%=(EXIREG.Fields.Item("LVONUM").Value)%>';">
              <input type="button" name="Submit32" value="Generate Print Out" class="sbttn" onClick="window.open('inv_DetailLVO_print.asp?refOrder=Y&LVOnum=<%=(EXIREG.Fields.Item("LVONUM").Value)%>');">
              <input type="button" name="btnRoute" value="Send Reminder " class="sbttn" onClick="window.location='Send_notification.asp?isUC=N&Loc=<%=(EXIREG("ROUTEUSER"))%>&LocName=<%=(EXIREG("LOCNAME"))%>&seqnum=<%=(EXIREG("LVONUM"))%>&VendorName=<%=(EXIREG("VENDORNAME"))%>&InvoiceNo=<%=(EXIREG("INVNUM"))%>'">
            </td>
          </tr>
          <% if(EXIREG.Fields.Item("STATUS").Value="INVOICED") or (EXIREG.Fields.Item("STATUS").Value="ROUTED") then %>
          <tr> 
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>Routing:&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td colspan="4"> 
              <input type="button" name="Submit4" value=" Route Invoice to User Coordinator " class="sbttn" onClick="return reroute('UC','<%=(EXIREG.Fields.Item("LVONUM").Value)%>')">
              <input type="button" name="Submit42" value=" Route Invoice to End User " class="sbttn" onClick="return reroute('EU','<%=(EXIREG.Fields.Item("LVONUM").Value)%>')">
            </td>
          </tr>
          <% end if %>
        </table>
      </form>
    </td>
  </tr>
  <tr> 
    <td width="4%">&nbsp;</td>
    <td width="2%" bgcolor="#FFFFFF">&nbsp;</td>
    <td bgcolor="#FFFFFF" width="94%">&nbsp;</td>
  </tr>
</table>
<form name="form2" method="get" action="Update_LVODetail.asp">
  <table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#bbbbbb">
    <tr bgcolor="#D1DDEF"> 
      <td width="4%" height="26"> 
        <div align="center"><font color="#000000"><b>No</b></font></div>
      </td>
      <td height="26"> 
        <div align="center"><font color="#000000"><b>Description</b></font></div>
      </td>
      <td width="5%" height="26"> 
        <div align="center"><font color="#000000"><b>Qty</b></font></div>
      </td>
      <td width="5%" height="26"> 
        <div align="center"><font color="#000000"><b>UoP</b></font></div>
      </td>
      <td width="8%" height="26"> 
        <div align="center"><font color="#000000"><b>Unit Cost</b></font></div>
      </td>
      <td width="8%" height="26"> 
        <div align="center"><font color="#000000"><b>Total</b></font></div>
      </td>
      <td height="26" width="10%"> 
        <div align="center"><b><b>Charge Code</b></b></div>
      </td>
      <td height="26" width="10%"> 
        <div align="center"><b><b>AFE</b></b></div>
      </td>
      <td height="26" width="8%"> 
        <div align="center"><b><b>Activity</b></b></div>
      </td>
      <td height="26" width="12%"> 
        <div align="center"><b>T3 Code</b></div>
      </td>
      <td height="26" width="5%"> 
        <div align="center"><b><font color="#FFFFFF"><font color="#000000"><b><b>Tax</b></b></font></font></b></div>
      </td>
    </tr>
    <% 
While ((Repeat1__numRows <> 0) AND (NOT LVODET.EOF)) 
%>
    <tr bgcolor="#FFFFFF" valign="top"> 
      <td width="4%"> 
        <div align="right"><%=(LVODET.Fields.Item("LINENUMBER").Value)%>.&nbsp;</div>
      </td>
      <td> 
        <input type="hidden" name="seqnum<%=(LVODET.Fields.Item("LINENUMBER").Value)%>" value="<%=(LVODET.Fields.Item("SEQNUM").Value)%>">
        <%=(LVODET.Fields.Item("DESCRIPTION").Value)%></td>
      <td width="5%"> 
        <div align="right"><%=(LVODET.Fields.Item("QTYREQUESTED").Value)%></div>
      </td>
      <td width="5%"> 
        <div align="center"><%=(LVODET.Fields.Item("UOP").Value)%></div>
      </td>
      <td width="8%"> 
        <div align="right"><%= FormatNumber((LVODET.Fields.Item("UNITCOST").Value), -1, -2, -2, -1) %></div>
      </td>
      <td width="8%"> 
        <div align="right"><%= FormatNumber((LVODET.Fields.Item("TOTAL").Value), -1, -2, -2, -1) %></div>
      </td>
      <td width="10%"> 
        <div align="center"> 
          <input type="text" name="ACCT<%=(LVODET.Fields.Item("LINENUMBER").Value)%>" size="8" maxlength="8" class="InputBox" value="<%=(LVODET.Fields.Item("ACCTCODE").Value)%>" >
          <input type="button" name="btACCT<%=(LVODET.Fields.Item("LINENUMBER").Value)%>" class="sbttn" onClick="openpopup2('AcctList.asp?fName=form2.ACCT<%=(LVODET.Fields.Item("LINENUMBER").Value)%>')" value="...">
        </div>
      </td>
      <td width="10%"> 
        <div align="center"> 
          <input type="text" name="AFE<%=(LVODET.Fields.Item("LINENUMBER").Value)%>" size="8" maxlength="8" class="InputBox" value="<%=(LVODET.Fields.Item("COSTCENTER").Value)%>" >
          <input type="button" name="btAFE<%=(LVODET.Fields.Item("LINENUMBER").Value)%>" value="..." class="sbttn" onClick="openpopup2('AFEList.asp?fName=form2.AFE<%=(LVODET.Fields.Item("LINENUMBER").Value)%>')" >
        </div>
      </td>
      <td width="8%"> 
        <div align="center"> 
          <input type="text" name="ACT<%=(LVODET.Fields.Item("LINENUMBER").Value)%>" size="4" maxlength="4" class="InputBox" value="<%=(LVODET.Fields.Item("ACTCODE").Value)%>" >
          <input type="button" name="btACT<%=(LVODET.Fields.Item("LINENUMBER").Value)%>" value="..." class="sbttn" onClick="openpopup2('ActivityList.asp?fName=form2.ACT<%=(LVODET.Fields.Item("LINENUMBER").Value)%>')" >
        </div>
      </td>
      <td width="12%"> 
        <div align="center"> 
          <input type="text" name="T3<%=(LVODET.Fields.Item("LINENUMBER").Value)%>" size="10" maxlength="10" class="InputBox" value="<%=(LVODET.Fields.Item("DEPTEMPCODE").Value)%>" >
          <input type="button" name="btT3<%=(LVODET.Fields.Item("LINENUMBER").Value)%>" value="..." class="sbttn" onClick="openpopup2('T3List.asp?fName=form2.T3<%=(LVODET.Fields.Item("LINENUMBER").Value)%>')" >
        </div>
      </td>
      <td width="5%"> 
        <div align="center"><%=(LVODET.Fields.Item("TAXCODE").Value)%></div>
      </td>
    </tr>
    <% 
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  LVODET.MoveNext()
Wend
%>
    <tr bgcolor="#FFFFFF"> 
      <td width="4%"> 
        <div align="right"></div>
      </td>
      <td> 
        <div align="center"> 
          <input type="submit" name="Submit7" value="  Update  " class="sbttn">
          <input type="hidden" name="ordernum" value="<%=(EXIREG.Fields.Item("LVONUM").Value)%>">
        </div>
      </td>
      <td width="5%">&nbsp;</td>
      <td width="5%">&nbsp;</td>
      <td width="8%"> 
        <div align="right"></div>
      </td>
      <td width="8%"> 
        <div align="right"></div>
      </td>
      <td width="10%">&nbsp;</td>
      <td width="10%">&nbsp;</td>
      <td width="8%">&nbsp;</td>
      <td width="12%">&nbsp;</td>
      <td width="5%">&nbsp;</td>
    </tr>
  </table>
</form>
</body>
</html>
<%
CompCode.Close()
%>
<%
EXIREG.Close()
%>
<%
LVODET.Close()
%>
